﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iOak.Data.Resumes;
using iOak.Domain.Resumes;

namespace iOak.Business.Resumes
{
    public partial class ResumeFieldService
    {
        private static readonly ResumeFieldRepository resumeFieldRepository = new ResumeFieldRepository("master");

        public ResumeField Retrieve(Guid rsumeFieldId)
        {
            return resumeFieldRepository.Retrieve(rsumeFieldId);
        }

        public List<ResumeField> GetDefaultFieldList()
        {
            return resumeFieldRepository.GetDefaultFieldList();
        }

        public void AddDefaultList(List<ResumeField> currentList, List<ResumeField> defaultList)
        {
            defaultList.ForEach(m =>
                {
                    int count = currentList.Count(item => item.ResumeFieldId == m.ResumeFieldId);
                    if (count == 0)
                    {
                        currentList.Add(m);
                    }
                });
        }
    }
}
